home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Grab Bag
/
Shareware Grab Bag.iso
/
007
/
bmgrep.arc
/
BMGREP.DOC
< prev
next >
Wrap
Text File
|
1986-12-10
|
3KB
|
132 lines
Page 1 bm
NAME
bm -- search a file for a string
SYNOPSIS
bm [option] ... [strings] [file]
DESCRIPTION
Bm searches the input files (standard input default) for lines
matching a string. Normally, each line found is copied to the
standard output. It is blindingly fast. Bm strings are fixed
sequences of characters: there are no wildcards, repetitions, or
other features of regular expressions. Bm is also case sensitive.
The following options are recognized.
-x (Exact) only lines matched in their entirety are printed
-l The names of files with matching lines are listed (once)
separated by newlines.
-c Only a count of the number of matches is printed
-e string
The string is the next argument after the -e flag. This
allows strings beginning with '-'.
-h No filenames are printed, even if multiple files are
searched.
-n Each line is preceded by the number of characters from the
beginning of the file to the match.
-s Silent mode. Nothing is printed (except error messages). This
is useful for checking the error status.
-f path The string list is taken from the path. This may be
either a file or a tty.
Unless the -h option is specified the file name is shown if there is
more than one input file. Care should be taken when using the
characters $ * [ ^ | ( ) and \ in the strings (listed on the
command line) as they are also meaningful to the Shell. It is safest
to enclose the entire expression argument in single quotes ' '.
Bm searches for lines that contain one of the (newline-separated)
strings, using the Boyer-Moore algorithm. It is far superior in
terms of speed to the grep (egrep, fgrep) family of pattern matchers
for fixed-pattern searching, and its speed increases with pattern
length.
SEE ALSO
grep(1)
DIAGNOSTICS
Exit status is 0 if any matches are found, 1 if none, 2 for syntax
errors or inaccessible files.
AUTHOR
Peter Bain (pdbain bnr-vpa), with modifications suggested by John
Gilmore and Amir Plivatsky
Page 2 bm
BUGS
Only 100 patterns are allowed.
Patterns may not contain newlines.
If a line (delimited by newlines, and the beginning and end of the
file) is longer than 8000 charcters (e.g. in a core dump), it will
not be completely printed.
If multiple patterns are specified, the order of the ouput lines is
not necessarily the same as the order of the input lines.
A line will be printed once for each different string on that line.
The algorithm cannot count lines.
The -n and -c work differently from fgrep.
The -v, -i, and -b are not available.